package com.iflytek.sbd.interceptor;

import com.iflytek.sbd.controller.DemoController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @program: sbd
 * @description:
 * @author: 陈英俊
 * @create: 2021-12-30 15:13
 */

public class ParameterInterceptor implements HandlerInterceptor {


    @Autowired
    private DemoController demoController;


    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        System.out.println("ParameterInterceptor的preHandle");
        return true;
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        System.out.println("ParameterInterceptor--->"+demoController);
        System.out.println("ParameterInterceptor的postHandle");
    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        System.out.println("ParameterInterceptor的afterCompletion");
    }
}
